﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MagicSauce.Filters;

namespace MagicSauce.Controllers
{
    public abstract class ApplicationController<TModelData, TType> : Controller

    {
        // MAGIC 7
        // Index or list
        // Detail
        // New Post / Get
        // Edit Post / Get
        // delete Post / Get


        public virtual ActionResult Index()
        {
            return HttpNotFound("This method does not exist");
        }

        public virtual ActionResult Detail(TType Id)
        {
            return HttpNotFound("this method does not exist");
        }

        [HttpGet]
        [ShowValidationErrors]
        public virtual ActionResult New()
        {
            return HttpNotFound("this method does not exist");
        }

        [HttpPost]
        public virtual RedirectToRouteResult New(TModelData data)
        {
            throw new NotImplementedException();
        }

        [HttpGet]
        public virtual ActionResult Edit(int Id)
        {
            return HttpNotFound("this method does not exist");
        }

        [HttpPost]
        public virtual RedirectToRouteResult Edit(int Id, TModelData data)
        {
            throw new NotImplementedException();
        }

        [HttpGet]
        public virtual ActionResult Delete(TType Id)
        {
            return HttpNotFound("this method does not exist");
        }

        [HttpPost]
        public virtual RedirectToRouteResult Destroy(TType Id)
        {
            throw new NotImplementedException();
        }




        protected void SaveModelAndState<TModelData>(TModelData model)
        {
            TempData["_inputModel"] = model;
            TempData["_modelState"] = this.ModelState;
        }

    }
}
